﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Collections;
namespace DAO
{
   public class SanBayDAO
    {
         DataTable dt;
        List<string> dsThamSo;
        ArrayList dsGiaTri;
       
        
        public SanBayDAO()
        {
            dt = new DataTable();
            dsThamSo = new List<string>();
            dsGiaTri = new ArrayList();
            
        }
        public DataTable layDanhSachSanBay(string maSanBayDi)
        {
          
            dsThamSo.Add("@maSanBayDi");
           
            dsGiaTri.Add(maSanBayDi);
           
            dt = DataProvider.ExecuteStoreProc("sp_laySanBay", dsThamSo, dsGiaTri);
            return dt;
        }
        public DataTable loadSanBayDi()
        {
            try
            {

                dt = DataProvider.ExecuteStoreProc("sp_loadSanBayDi", null, null);
                return dt;
            }
            catch (Exception ex)
            {
                return null;
            }
        }
         public DataTable loadSanBayDi(string maSanBayDen)
        {
            try
            {
                dsThamSo.Add("@maSanBay");

                dsGiaTri.Add(maSanBayDen);
                dt = DataProvider.ExecuteStoreProc("sp_loadSanBayDi_TheoSanBayDen", dsThamSo, dsGiaTri);
                return dt;
            }
            catch (Exception ex)
            {
                return null;
            }
        }
     
        public DataTable loadSanBayDen()
        {
            try
            {
                dt = DataProvider.ExecuteStoreProc("sp_loadSanBayDen", null, null);
                return dt;
            }
            catch (Exception ex)
            {
                return null;
            }
        }
        public DataTable loadSanBayDen(string maSanBayDi)
        {
            try
            {
                dsThamSo.Add("@maSanBay");

                dsGiaTri.Add(maSanBayDi);
                dt = DataProvider.ExecuteStoreProc("sp_loadSanBayDen_TheoSanBayDi ",dsThamSo, dsGiaTri);
                return dt;
            }
            catch (Exception ex)
            {
                return null;
            }
        }
    }
}
